﻿#region Using Region
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ICE.Vacations.DataBase;

using Unisys.InfoImage.IIFCAL.IIFWorkflow;
using System.Data.SqlClient;
#region PDF References

using iTextSharp.text.html.simpleparser;
using iTextSharp.text;
using iTextSharp.text.pdf;

#endregion


#endregion

namespace ICE.Vacations.Request
{
    public  class Documents
    {
        #region Global Resources

        #region BD RECURSOS

        public string username { get; set; }
        public string employeeID { get; set; }
        public string apellido1 { get; set; }
        public string apellido2 { get; set; }
        public string employeeName { get; set; }
        public string eMail { get; set; }
        public string cod_cf { get; set; }
        public string cod_direccion { get; set; }
        public string tipo { get; set; }
        public string aprobador1 { get; set; }
        public string aprobador2 { get; set; }
        public string aprobador3 { get; set; }

        #endregion

        #region Form View

        public string managerID { get; set; }
        public string docUnit { get; set; }
        public string date { get; set; }
        public string year { get; set; }
        public string revision { get; set; }
        public string dateFrom { get; set; }
        public string dateTo { get; set; }
        public int totalDays { get; set; }
        public string requestID { get; set; }
        public string bossID { get; set; }
        public string state { get; set; }

        #endregion


        private SQLDataClass sqlData = new SQLDataClass();
        private OracleDataClass oracleData = new OracleDataClass();

        #region Workflow Variables

        //private IIFCALWorkflowVariableValue aprob_1 = new IIFCALWorkflowVariableValue();
        //private IIFCALWorkflowVariableValue aprob_2 = new IIFCALWorkflowVariableValue();
        //private IIFCALWorkflowVariableValue aprob_3 = new IIFCALWorkflowVariableValue();
        //private IIFCALWorkflowVariableValue totalAprob = new IIFCALWorkflowVariableValue();
        
        #endregion

        #endregion

        public Documents convertRequestObject(SqlDataReader reader)
        {
            Documents document = new Documents();
            while (reader.Read())
            {
                try
                {
                        document.username = reader.GetSqlValue(0).ToString();                       
                        document.employeeID = reader.GetSqlValue(1).ToString();
                        document.apellido1= reader.GetSqlValue(2).ToString();
                        document.apellido2 = reader.GetSqlValue(3).ToString();
                        document.employeeName = reader.GetSqlValue(4).ToString();
                        document.eMail = reader.GetSqlValue(5).ToString();

                        document.tipo = reader.GetSqlValue(8).ToString();
                        document.aprobador1 = reader.GetSqlValue(9).ToString();
                        document.aprobador2 = reader.GetSqlValue(10).ToString();
                        document.aprobador3 = reader.GetSqlValue(11).ToString();
 
                }
                catch (Exception e) {
                
                }
                
            }
            return document;
        }

        //public void CreateRequest(string windowsUser)
        //{
        //    try
        //    {
        //        #region RRHH Connection

        //        try
        //        {
        //            sqlData.OpenConnection();
        //        }
        //        catch (Exception exc)
        //        { 
        //        }
        //        #endregion

        //        #region Set Type - Workflow variables

        //        aprob_1.Type = IIFWorkflowVariableTypeConstants.WorkflowVariableTypeInteger;
        //        aprob_2.Type = IIFWorkflowVariableTypeConstants.WorkflowVariableTypeInteger;
        //        aprob_3.Type = IIFWorkflowVariableTypeConstants.WorkflowVariableTypeInteger;
        //        totalAprob.Type = IIFWorkflowVariableTypeConstants.WorkflowVariableTypeInteger;

        //        #endregion

        //        #region Set Value - Workflow Variables

        //        aprob_1.Value = 0;
        //        aprob_2.Value = 0;
        //        aprob_3.Value = 0;
        //        totalAprob.Value = 0; // Por definir de acuerdo a RRHH 

        //        #endregion

        //        //#region Set Form Values
        //        //IIFWorkItem workitem = new IIFWorkItem();
                
        //        //#endregion


        //        #region Save  - SOLICITUDES
        //        //sqlData.OpenConnection();
                
        //        #endregion

        //    }
        //    catch (Exception exc)
        //    { 
        //    }
            
        //}

        public void SaveRequest() 
        { }
        
        public void CheckRequest()
        { }

        public void SearchRequest()
        { }
    }
}
